package cn.gson.crm.model.pojo;

import java.io.Serializable;
import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the PURCHASE_TB database table.
 * 
 */
@Entity
@Table(name="PURCHASE_TB")
@NamedQuery(name="PurchaseTb.findAll", query="SELECT p FROM PurchaseTb p")
public class PurchaseTb implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="PURCHASE_TB_PURCHASEID_GENERATOR", sequenceName="SEQ_39")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="PURCHASE_TB_PURCHASEID_GENERATOR")
	@Column(name="PURCHASE_ID")
	private long purchaseId;

	@Column(name="GONG_ID")
	private String gongId;

	@Column(name="GONG_NAME")
	private String gongName;

	@Column(name="PURCHASE_CANG")
	private String purchaseCang;

	@Column(name="PURCHASE_MAN")
	private String purchaseMan;

	@Column(name="PURCHASE_MONEY")
	private BigDecimal purchaseMoney;

	@Column(name="PURCHASE_STA")
	private String purchaseSta;

	@Column(name="PURCHASE_THEME")
	private String purchaseTheme;

	@Temporal(TemporalType.DATE)
	@Column(name="PURCHASE_TIME")
	private Date purchaseTime;

	//bi-directional many-to-one association to Paymentplan
	@OneToMany(mappedBy="purchaseTb")
	private List<Paymentplan> paymentplans;

	//bi-directional many-to-one association to Paymentrecord
	@OneToMany(mappedBy="purchaseTb")
	private List<Paymentrecord> paymentrecords;

	//bi-directional many-to-one association to Purchasedetail
	@OneToMany(mappedBy="purchaseTb")
	private List<Purchasedetail> purchasedetails;

	//bi-directional many-to-one association to Purchaseticket
	@OneToMany(mappedBy="purchaseTb")
	private List<Purchaseticket> purchasetickets;

	//bi-directional many-to-one association to Paymentplan
	@ManyToOne
	@JoinColumn(name="PP_ID")
	private Paymentplan paymentplan;

	//bi-directional many-to-one association to Paymentrecord
	@ManyToOne
	@JoinColumn(name="PR_ID")
	private Paymentrecord paymentrecord;

	//bi-directional many-to-one association to Purchaseticket
	@ManyToOne
	@JoinColumn(name="PT_ID")
	private Purchaseticket purchaseticket;

	public PurchaseTb() {
	}

	public long getPurchaseId() {
		return this.purchaseId;
	}

	public void setPurchaseId(long purchaseId) {
		this.purchaseId = purchaseId;
	}

	public String getGongId() {
		return this.gongId;
	}

	public void setGongId(String gongId) {
		this.gongId = gongId;
	}

	public String getGongName() {
		return this.gongName;
	}

	public void setGongName(String gongName) {
		this.gongName = gongName;
	}

	public String getPurchaseCang() {
		return this.purchaseCang;
	}

	public void setPurchaseCang(String purchaseCang) {
		this.purchaseCang = purchaseCang;
	}

	public String getPurchaseMan() {
		return this.purchaseMan;
	}

	public void setPurchaseMan(String purchaseMan) {
		this.purchaseMan = purchaseMan;
	}

	public BigDecimal getPurchaseMoney() {
		return this.purchaseMoney;
	}

	public void setPurchaseMoney(BigDecimal purchaseMoney) {
		this.purchaseMoney = purchaseMoney;
	}

	public String getPurchaseSta() {
		return this.purchaseSta;
	}

	public void setPurchaseSta(String purchaseSta) {
		this.purchaseSta = purchaseSta;
	}

	public String getPurchaseTheme() {
		return this.purchaseTheme;
	}

	public void setPurchaseTheme(String purchaseTheme) {
		this.purchaseTheme = purchaseTheme;
	}

	public Date getPurchaseTime() {
		return this.purchaseTime;
	}

	public void setPurchaseTime(Date purchaseTime) {
		this.purchaseTime = purchaseTime;
	}

	public List<Paymentplan> getPaymentplans() {
		return this.paymentplans;
	}

	public void setPaymentplans(List<Paymentplan> paymentplans) {
		this.paymentplans = paymentplans;
	}

	public Paymentplan addPaymentplan(Paymentplan paymentplan) {
		getPaymentplans().add(paymentplan);
		paymentplan.setPurchaseTb(this);

		return paymentplan;
	}

	public Paymentplan removePaymentplan(Paymentplan paymentplan) {
		getPaymentplans().remove(paymentplan);
		paymentplan.setPurchaseTb(null);

		return paymentplan;
	}

	public List<Paymentrecord> getPaymentrecords() {
		return this.paymentrecords;
	}

	public void setPaymentrecords(List<Paymentrecord> paymentrecords) {
		this.paymentrecords = paymentrecords;
	}

	public Paymentrecord addPaymentrecord(Paymentrecord paymentrecord) {
		getPaymentrecords().add(paymentrecord);
		paymentrecord.setPurchaseTb(this);

		return paymentrecord;
	}

	public Paymentrecord removePaymentrecord(Paymentrecord paymentrecord) {
		getPaymentrecords().remove(paymentrecord);
		paymentrecord.setPurchaseTb(null);

		return paymentrecord;
	}

	public List<Purchasedetail> getPurchasedetails() {
		return this.purchasedetails;
	}

	public void setPurchasedetails(List<Purchasedetail> purchasedetails) {
		this.purchasedetails = purchasedetails;
	}

	public Purchasedetail addPurchasedetail(Purchasedetail purchasedetail) {
		getPurchasedetails().add(purchasedetail);
		purchasedetail.setPurchaseTb(this);

		return purchasedetail;
	}

	public Purchasedetail removePurchasedetail(Purchasedetail purchasedetail) {
		getPurchasedetails().remove(purchasedetail);
		purchasedetail.setPurchaseTb(null);

		return purchasedetail;
	}

	public List<Purchaseticket> getPurchasetickets() {
		return this.purchasetickets;
	}

	public void setPurchasetickets(List<Purchaseticket> purchasetickets) {
		this.purchasetickets = purchasetickets;
	}

	public Purchaseticket addPurchaseticket(Purchaseticket purchaseticket) {
		getPurchasetickets().add(purchaseticket);
		purchaseticket.setPurchaseTb(this);

		return purchaseticket;
	}

	public Purchaseticket removePurchaseticket(Purchaseticket purchaseticket) {
		getPurchasetickets().remove(purchaseticket);
		purchaseticket.setPurchaseTb(null);

		return purchaseticket;
	}

	public Paymentplan getPaymentplan() {
		return this.paymentplan;
	}

	public void setPaymentplan(Paymentplan paymentplan) {
		this.paymentplan = paymentplan;
	}

	public Paymentrecord getPaymentrecord() {
		return this.paymentrecord;
	}

	public void setPaymentrecord(Paymentrecord paymentrecord) {
		this.paymentrecord = paymentrecord;
	}

	public Purchaseticket getPurchaseticket() {
		return this.purchaseticket;
	}

	public void setPurchaseticket(Purchaseticket purchaseticket) {
		this.purchaseticket = purchaseticket;
	}

}